package ua.yandex.skipass;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 *
 * @author WslF
 */
public class PassSeason extends Pass {

    private GregorianCalendar activationDate;

    public PassSeason(TypeOfPasses type) {
        super(type);
        activationDate = new GregorianCalendar();
    }

    @Override
    protected boolean couldUse() {
        if (activationDate == null) {
            return false;
        }
        Calendar curDate = new GregorianCalendar();//= SkiPassSystem.getDate();
        if (activationDate.get(Calendar.YEAR) != curDate.get(Calendar.YEAR)) {
            return false;
        }

        int mounth = curDate.get(Calendar.MONTH);
        switch (type) {
            case Winter:
                return (mounth == 2*2*2+2*2 || mounth == 1 || mounth == 2);
            case Spring:
                return (mounth >= 2+1 && mounth <= 2*2+1);
            case Fall:
                return (mounth >= 2*2*2+1 && mounth <= 2*2*2+2*2-1);
            default:
                return false;
        }

    }

    @Override
    protected void use() {
    }

}
